Ext.namespace('Ext.app.designer');

Ext.app.designer.room = function(){
	this.room = null;
}

Ext.app.designer.room.prototype = {
	
	createRoom : function(){
		var roomHeight = 10;
		var roomWidth = 20;
		var roomLength = 20;
		
		var room = new THREE.Object3D();
		
		var geometry;
        var material = new THREE.MeshBasicMaterial( { color: "0x" + "acc4d9"} );
		
		geometry = new THREE.CubeGeometry(roomLength, roomWidth, 0.5);
		var roomFloorMesh = new THREE.Mesh(geometry,material);
		roomFloorMesh.rotation.set(Math.PI/2,0,0);
		room.add(roomFloorMesh);
		
		geometry = new THREE.CubeGeometry(roomLength, roomWidth, 0.5);
        var roomRoofMesh = new THREE.Mesh(geometry,material);
		roomRoofMesh.rotation.set(Math.PI / 2, 0, 0);
		roomRoofMesh.position.set(0 , roomHeight, 0);
		room.add(roomRoofMesh);
		
		geometry = new THREE.CubeGeometry(roomLength, roomHeight, 0.5);
        var frontwallMesh = new THREE.Mesh(geometry,material);
		frontwallMesh.rotation.set(0, 0, 0);
		frontwallMesh.position.set(0, (roomHeight / 2), (roomWidth / 2));
		room.add(frontwallMesh);
		
		geometry = new THREE.CubeGeometry(roomLength, roomHeight, 0.5);
        var backwallMesh = new THREE.Mesh(geometry,material);
		backwallMesh.rotation.set(0, 0, 0);
		backwallMesh.position.set(0, (roomHeight / 2), -(roomWidth / 2));
		room.add(backwallMesh);
		
		geometry = new THREE.CubeGeometry(roomWidth, roomHeight, 0.5);
        var leftsidewallMesh = new THREE.Mesh(geometry,material);
		leftsidewallMesh.rotation.set(0, (Math.PI / 2), 0);
		leftsidewallMesh.position.set(-(roomLength / 2), (roomHeight / 2), 0);
		room.add(leftsidewallMesh);
        
		geometry = new THREE.CubeGeometry(roomWidth, roomHeight, 0.5);
        var rightsidewallMesh = new THREE.Mesh(geometry,material);
		rightsidewallMesh.rotation.set(0, (Math.PI / 2), 0);
		rightsidewallMesh.position.set((roomLength / 2), (roomHeight / 2), 0);
		room.add(rightsidewallMesh);
		
		this.room = room;
		return room;
	},
	
	moveRoom : function(x, y, z){
		this.room.position.set(x, y, z);
	},
	
	rotateRoom : function(x, y, z){
		this.room.rotation.set(x, y, z);
	},
	
	scaleRoom : function(x, y, z){
		this.room.scale.set(x, y, z);
	}
}